package com.qing.cheng.service.impl;


import com.qing.cheng.dto.QcCourseStateDto;
import com.qing.cheng.entity.QcCourseState;
import com.qing.cheng.mapper.QcCourseStateMapper;
import com.qing.cheng.service.QcCourseStateService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class QcCourseStateServiceImpl implements QcCourseStateService {

    @Autowired(required = false)
    private QcCourseStateMapper qcCourseStateMapper;



    @Override
    public List<QcCourseStateDto> getAllStateByCourseId(Integer courseId) {
        List<QcCourseStateDto> qcCourseStateDtos = new ArrayList<>();
        List<QcCourseState> courseStates = qcCourseStateMapper.listAllByCourseId(courseId);
        BeanUtils.copyProperties(courseStates,qcCourseStateDtos);
        return qcCourseStateDtos;
    }

    @Override
    public void insertSelective(QcCourseState courseState) {
        qcCourseStateMapper.insertSelective(courseState);
    }
}
